package com.example.miaosha.controller;

/**
 * Created by lerry_li on 2020/09/23
 */
public class BaseController {
    //定义exceptionHandler解决未被controller层吸收的exception
//    @ExceptionHandler(Exception.class)
//    @ResponseStatus(HttpStatus.OK)
//    @ResponseBody
//    public Object handlerException(HttpServletRequest request, Exception exception) {
//
//        Map<String, Object> hashMap = new HashMap<>();
//        if (exception instanceof BusinessException) {
//            BusinessException businessException = (BusinessException) exception;
//            hashMap.put("errCode", businessException.getErrCode());
//            hashMap.put("errMsg", businessException.getErrMsg());
//        } else {
//            hashMap.put("errCode", EmBusinessError.UNKNOWN_ERROR.getErrCode());
//            hashMap.put("errMsg", EmBusinessError.UNKNOWN_ERROR.getErrMsg());
//        }
//
//        return CommonReturnType.create(hashMap, "fail");
//    }
}
